package com.wz.jiangsu.main;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;

/**
 * @program: wz
 * @author: wangzhou
 * @create: 2024-01-03 10:33
 * @description:
 **/
public class TestStr {

    public static void main(String[] args) throws Exception{

//        String str = "{\"agent_ip\":\"1.1.50.8\",\"data_type\":\"ENDPOINT_LOG_ONDEMAND_REPORT\"," +
//                "\"payload\":{\"content\":\"MTouXGxvZ2NvbGxlY3Rvcl9jb25mXHdhenVoX3Rlc3QubG9nOkZlYiAxNC" +
//                "AxMjoxOTowNCBsb2NhbGhvc3QgY3VzdG9tX3Byb2dyYW06IFRoaXMgaXMgYSBsb2cgbWVzc2FnZS4gVGhpcyBp" +
//                "cyBteSBuYW1lOiB3YW5ndGVuZ3RlY2g=\",\"report_time\":\"2024/1/28 15:31\",\"type\":\"auth_log\"},\"ts\"" +
//                ":1706599906,\"uuid\":\"654f0db4-303e-4829-9707-e49ba48a2792\",\"wazuh_engine\":{\"timestamp\":\"2024-" +
//                "01-30T15:11:37.083+0800\",\"rule\":{\"level\":3,\"description\":\"my name is wangtengtech\",\"id\":\"11209\",\"fir" +
//                "edtimes\":3,\"mail\":false,\"groups\":[\"local\",\"syslog\",\"sshd\"]},\"agent\":{\"id\":\"000\",\"name\":\"localho" +
//                "st.localdomain\"},\"manager\":{\"name\":\"localhost.localdomain\"},\"id\":\"1706253097.0\",\"full_log\":\"Feb 14 12:1" +
//                "9:04 localhost custom_program: This is a log message. This is my name: wangtengtech\",\"predecoder\":{\"program_name\":\"cus" +
//                "tom_program\",\"timestamp\":\"Feb 14 12:19:04\",\"hostname\":\"localhost\"},\"decoder\":{\"name\":\"custom_decoder\"},\"" +
//                "location\":\".\\logcollector_conf\\wazuh_test.log\"}}";
////        String str = "{\"agent_ip\":\"1.1.50.8\",\"data_type\":\"ENDPOINT_LOG_ONDEMAND_REPORT\",\"payload\":{\"content\":\"MTouXGxvZ2NvbGxlY3Rvcl9jb25mXHdhenVoX3Rlc3QubG9nOkZlYiAxNCAxMjoxOTowNCBsb2NhbGhvc3QgY3VzdG9tX3Byb2dyYW06IFRoaXMgaXMgYSBsb2cgbWVzc2FnZS4gVGhpcyBpcyBteSBuYW1lOiB3YW5ndGVuZ3RlY2g=\",\"report_time\":\"2024/1/28 15:31\",\"type\":\"auth_log\"},\"ts\":1706599906,\"uuid\":\"654f0db4-303e-4829-9707-e49ba48a2792\",\"wazuh_engine\":{\"timestamp\":\"2024-01-30T15:11:37.083+0800\",\"rule\":{\"level\":3,\"description\":\"my name is wangtengtech\",\"id\":\"11209\",\"firedtimes\":3,\"mail\":false,\"groups\":[\"local\",\"syslog\",\"sshd\"]},\"agent\":{\"id\":\"000\",\"name\":\"localhost.localdomain\"},\"manager\":{\"name\":\"localhost.localdomain\"},\"id\":\"1706253097.0\",\"full_log\":\"Feb 14 12:19:04 localhost custom_program: This is a log message. This is my name: wangtengtech\",\"predecoder\":{\"program_name\":\"custom_program\",\"timestamp\":\"Feb 14 12:19:04\",\"hostname\":\"localhost\"},\"decoder\":{\"name\":\"custom_decoder\"},\"location\":\"\\logcollector_conf\\wazuh_test.log\"}}";
////        WazuhSecurityEventDataCommonDto wazuhSecurityEventDataCommonDto = JSON.parseObject(str, WazuhSecurityEventDataCommonDto.class);
//        WazuhSecurityEventDataCommonDto wazuhSecurityEventDataCommonDto1 = new ObjectMapper().readValue(str, WazuhSecurityEventDataCommonDto.class);
//        WazuhSecurityEventDataCommonDto dto =JSONUtil.toBean(str, WazuhSecurityEventDataCommonDto.class);
//        System.out.println(dto);
        String str = "{\"agent_ip\":\"1.1.50.9\",\"data_type\":\"ENDPOINT_LOG_ONDEMAND_REPORT\",\"payload\":{\"content\":\"MTouXGxvZ2NvbGxlY3Rvcl9jb25mXHdhenVoX3Rlc3QubG9nOkZlYiAxNCAxMjoxOTowNCBsb2NhbGhvc3QgY3VzdG9tX3Byb2dyYW06IFRoaXMgaXMgYSBsb2cgbWVzc2FnZS4gVGhpcyBpcyBteSBuYW1lOiB3YW5ndGVuZ3RlY2g=\",\"report_time\":\"2024/1/28 15:31\",\"type\":\"auth_log\"},\"ts\":1706599906,\"uuid\":\"654f0db4-303e-4829-9707-e49ba48a2792\",\"wazuh_engine\":{\"timestamp\":\"2024-01-30T15:11:37.083+0800\",\"rule\":{\"level\":3,\"description\":\"my name is wangtengtech\",\"id\":\"12144\",\"firedtimes\":3,\"mail\":false,\"groups\":[\"local\",\"syslog\",\"sshd\"]},\"agent\":{\"id\":\"000\",\"name\":\"localhost.localdomain\"},\"manager\":{\"name\":\"localhost.localdomain\"},\"id\":\"1706253097.0\",\"full_log\":\"Feb 14 12:19:04 localhost custom_program: This is a log message. This is my name: wangtengtech\",\"predecoder\":{\"program_name\":\"custom_program\",\"timestamp\":\"Feb 14 12:19:04\",\"hostname\":\"localhost\"},\"decoder\":{\"name\":\"custom_decoder\"},\"location\":\"\"}}";
        JSONObject parseObj = JSONUtil.parseObj(str);
        System.out.println(parseObj);


    }
}
